package com.qiedan.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class FileConfig implements WebMvcConfigurer {
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //System.getProperty("user.dir"); //返回用户目录
        //System.getProperty("file.separator");// 路径分割符

        //用户头像地址的定位
        registry.addResourceHandler("/userImg/**").addResourceLocations(
                "file:"+ "C:/java-idea/origin-of-khitan/ItemImg/"
        );

        //菜品图片地址定位
        registry.addResourceHandler("/itemImg/**").addResourceLocations(
                "file:"+ "C:/java-idea/origin-of-khitan/ItemImg/"
        );
        //前台用户头像地址
        registry.addResourceHandler("/avatorImages/**").addResourceLocations(
                "file:"+System.getProperty("user.dir")+System.getProperty("file.separator")+"avatorImages"+System.getProperty("file.separator")
=======
                "file:"+ "E:/gg/origin-of-khitan/itemImg/"
>>>>>>> Stashed changes
        );
//        addResourceLocations("file:" + "D:/WebFile/file/img/")
    }
}